#ifndef __NOTIFICATION_CENTER_H__
#define __NOTIFICATION_CENTER_H__

#include "cocos2d.h"
#include "../CoreMacro.h"
#include "NotificationDelegate.h"
#include "../StaticArray/LStaticArray.h"

NS_CC_CORE_BEGIN


//Override this class to handler notification message
class NotificationNode : public NotificationDelegate
{
public :
	NotificationNode( );
	virtual ~NotificationNode( );
};

/*
	This class use to broadcast Notification message to all class
	which was inheritance from NotificationNode base class
*/
class NotificationCenter
{
public:
	NotificationCenter( );
	virtual ~NotificationCenter( );

	static	NotificationCenter*		sharedNotificationCenter	( );

	void			registerHandlerMessage		( NotificationDelegate* pHandler );
	void			unregisterHandlerMessage	( NotificationDelegate* pHandler , bool onRelease = false );

	void			post						( int messageId , int messageSubId = 0 );
	void			post						( NotificationData* data , int messageId , int messageSubId = 0 );

	static void		purge						( );
private:
	LStaticArray<NotificationDelegate>*			m_pListHandler;
};

NS_CC_CORE_END

#endif //__NOTIFICATION_CENTER_H__